package com.suntianci.stock.mapper;

import com.suntianci.stock.pojo.entity.SysUserRole;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author 孙天赐
* @description 针对表【sys_user_role(用户角色表)】的数据库操作Mapper
* @createDate 2024-12-24 15:39:27
* @Entity com.suntianci.stock.pojo.entity.SysUserRole
*/
public interface SysUserRoleMapper {

    int deleteByPrimaryKey(Long id);

    int insert(SysUserRole record);

    int insertSelective(SysUserRole record);

    SysUserRole selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SysUserRole record);

    int updateByPrimaryKey(SysUserRole record);

    /**
     * 根据指定用户id查询用户所有角色
     * @param userId
     * @return
     */
    List<Object> getRolesByUserId(Long userId);

    /**
     * 根据用户id删除信息
     * @param userId
     * @return
     */
    int deleteByUserId(Long userId);

    /**
     *  根据用户id批量删除信息
     * @param userIds
     * @return
     */
    int batchDeleteByUserId(@Param("userIds") List<Long> userIds);

    /**
     * 根据角色id删除信息
     * @param roleId
     * @return
     */
    int deleteByRoleId(Long roleId);
}
